package com.example.androidproject.ui.fragment;


import android.app.Activity;
import android.view.View;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.androidproject.R;
import com.example.androidproject.ui.base.IBasePresenter;
import com.example.androidproject.ui.base.IRefreshListFragment;
import com.hyg.base.ui.common.FragmentContainerActivity;

import java.util.List;

/**
 * Author: huangyuguang
 * Date: 2022/5/11
 * Description: 上拉刷新下拉加载更多列表
 */
public class TestListFragment extends IRefreshListFragment<String, IBasePresenter> {

    public static void launch(Activity from){
        FragmentContainerActivity.getInstance().launch(from,TestListFragment.class);
    }

    @Override
    protected IBasePresenter createPresenter() {
        return null;
    }

    @Override
    protected void initViewAndData() {
        setPageSize(20);//TODO
    }

    @Override
    protected void onItemClick(BaseQuickAdapter adapter, View view, int position) {
    }

    @Override
    protected BaseQuickAdapter<String, BaseViewHolder> inflateBaseQuickAdapter() {
        return new MyTeamAdapter1(null);
    }

    @Override
    protected void loadData(int pageSize,int page) {
//        RetrofitHelper.getApiService()
//                .getTest(pageSize,page)
//                .compose(RxUtil.rxSchedulerHelper(this, true))
//                .subscribe(new APICallback<String>() {
//                    @Override
//                    public void onSuccess(String response) {
//                        onNextData(response);
//                    }
//
//                    @Override
//                    public void onError(Throwable e) {
//                        super.onError(e);
//                        stopRefresh();
//                    }
//                });
    }


    class MyTeamAdapter1 extends BaseQuickAdapter<String, BaseViewHolder> {

        public MyTeamAdapter1(@Nullable List<String> data) {
            super(R.layout.layout_footer_load_more,data);
        }

        @Override
        protected void convert(BaseViewHolder helper, String item) {
//            helper.setText(R.id.userNameTv,item);
        }
    }
}
